package schedule;

import java.io.Serializable;
import java.util.Date;
import java.util.Timer;

public class Appointment implements Serializable{
	private int id;
	private String title;
	private Date date; //startdate
	private Date end;
	private String description;
	
	public Appointment(String title, Date date, Date end, String description) throws Exception{
		setTitle(title);
		setDate(date);
		setDescription(description);
		setEnd(end);
		setId(0);
	}
	
	public Date getEnd() {
		return end;
	}

	public void setEnd(Date end) throws Exception{
		if (end.compareTo(date) > 0 ){
			this.end = end;
		} else{
			throw new Exception("end-date earlier than or equal to beginning-date");
		}
	}

	public void setDescription(String description){
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
//		return super.toString();
		return getTitle() + "    " + "Start: " + getDate();
	}
	
	
	
}
